this.BX=this.BX||{};(function(e,t,i,s){"use strict";var o={controlsOptions:{library:false},preferredRenderer:"webgl",export:{type:"data-url",download:false},megapixels:2,defaultControl:"filter",forceCrop:false,assets:{baseUrl:"/bitrix/js/main/imageeditor/external/photoeditorsdk/assets"}};var _={owner:"Bitrix, Inc.",version:"2.1",enterprise_license:false,available_actions:["magic","filter","transform","sticker","text","adjustments","brush","focus","frames","camera"],features:["adjustment","filter","focus","overlay","transform","text","sticker","frame","brush","camera","library","export"],platform:"HTML5",app_identifiers:[],api_token:"QbbG4guiONSDiVtWkcvw8A",domains:["https://api.photoeditorsdk.com"],issued_at:1534847608,expires_at:null,signature:"QgxAUoamxsnyqgFEQIoyj7168MituWvgVbj8VIr5EBjVG0HZSBmDh3XLU+u3NWTC2GUiZ6FB9GGB0Otf6mZ4VlhiXtyE4Xf61tE+PiFt4LPjGlAURCGl1yT9oGVBdWgb8lu8QhZ224g4TmPzNBeA5lDZwOaS/ESOZjltp0T5RE70NMpSPkSj8HEgO5zX2LnBt0kBpVj7xGxiprFzSn8P30m8+9IX0OuwGJ4AJZnLOB97pz1V1/I50RUgyvRDh7esZ/GdqkewRoGUwkybqHC2oQH15koZThKnEJZ9ufw1JyNVeUDmNvDysDdiLh/zGFgx3yVrBzAxfDAMnQhPpHUhgSlOh1W1YA3TKU7itR2vbXs7sd0syUCvAYMHMjgfUvCBfUKG5d2GOhg1jvd3a+wuVeloTEGwWFnhCpuoY7fHc991inKKCfH4EG4aeAJ5dLnFsZznyOxKMTOWMlmsVMRpW5tjNHP9nSDlj5s5XBX2XVVDkp2gj3oU2znUGY/uc8lczDvHpx7s9PRd7lp5U16QMOXujWWY9iYraNzwyqa2mUrxDhS/PSrlgd8F39iadeIE8bJQHLTVZjlanVZEJwx19MuGEBnYc5SWPkauhVCXFhdlrLj2zIzd1KYEEs1sbMQ4H/IVszF9mHBGJXSZCdOweXiWVHeg0o9UvSyS/sVwZjw="};var a={pesdk:{common:{title:{error:s.Loc.getMessage("IMAGE_EDITOR_ERROR")},text:{loading:s.Loc.getMessage("IMAGE_EDITOR_LOADING"),updating:s.Loc.getMessage("IMAGE_EDITOR_UPDATING")},button:{cancel:s.Loc.getMessage("IMAGE_EDITOR_CANCEL")}},editor:{button:{export:s.Loc.getMessage("IMAGE_EDITOR_EXPORT"),save:s.Loc.getMessage("IMAGE_EDITOR_EXPORT"),load:s.Loc.getMessage("IMAGE_EDITOR_NEW"),close:s.Loc.getMessage("IMAGE_EDITOR_CLOSE"),newImageChangesLostWarningYes:s.Loc.getMessage("IMAGE_EDITOR_YES"),newImageChangesLostWarningNo:s.Loc.getMessage("IMAGE_EDITOR_NO"),discardChangesWarningKeep:s.Loc.getMessage("IMAGE_EDITOR_DISCARD_CHANGES_KEEP_CHANGES_BUTTON"),discardChangesWarningDiscard:s.Loc.getMessage("IMAGE_EDITOR_DISCARD_CHANGES_DISCARD_BUTTON")},title:{newImageChangesLostWarning:s.Loc.getMessage("IMAGE_EDITOR_IMAGE_NEW_IMAGE_TITLE"),imageResizedWarning_maxMegaPixels:s.Loc.getMessage("IMAGE_EDITOR_IMAGE_RESIZED_TITLE"),imageResizedWarning_maxDimensions:s.Loc.getMessage("IMAGE_EDITOR_IMAGE_RESIZED_TITLE"),fontLoadingError:s.Loc.getMessage("IMAGE_EDITOR_ERROR_FONT_LOADING_ERROR"),discardChangesWarning:s.Loc.getMessage("IMAGE_EDITOR_DISCARD_CHANGES_DISCARD_BUTTON")},text:{newImageChangesLostWarning:s.Loc.getMessage("IMAGE_EDITOR_IMAGE_NEW_IMAGE_TITLE"),imageResizedWarning_maxMegaPixels:s.Loc.getMessage("IMAGE_EDITOR_IMAGE_RESIZED_DESCRIPTION"),imageResizedWarning_maxDimensions:s.Loc.getMessage("IMAGE_EDITOR_IMAGE_RESIZED_DESCRIPTION"),renderingError:"An error has occurred while rendering the image.",exporting:s.Loc.getMessage("IMAGE_EDITOR_EXPORTING"),saving:s.Loc.getMessage("IMAGE_EDITOR_EXPORTING"),loading:s.Loc.getMessage("IMAGE_EDITOR_LOADING"),resizing:s.Loc.getMessage("IMAGE_EDITOR_RESIZING"),loadingFonts:s.Loc.getMessage("IMAGE_EDITOR_LOADING_FONTS"),fontLoadingError:"The following fonts could not be loaded: ${fonts}.",webcamUnavailableError:s.Loc.getMessage("IMAGE_EDITOR_ERROR_WEBCAM_UNAVAILABLE"),invalidFileTypeError:s.Loc.getMessage("IMAGE_EDITOR_ERROR_UNSUPPORTED_FILE_TYPE"),imageLoadingError:s.Loc.getMessage("IMAGE_EDITOR_POPUP_ERROR_MESSAGE_TEXT"),discardChangesWarning:"You have unsaved changes. Are you sure you want to discard the changes?"}},library:{title:{name:s.Loc.getMessage("IMAGE_EDITOR_LIBRARY_TITLE")},button:{fileDropZone:s.Loc.getMessage("IMAGE_EDITOR_LIBRARY_DROP_ZONE"),fileDropZoneHovered:s.Loc.getMessage("IMAGE_EDITOR_LIBRARY_DROP_ZONE_HOVERED")},placeholder:{search:s.Loc.getMessage("IMAGE_EDITOR_LIBRARY_SEARCH")},text:{noResults:"No results"}},transform:{title:{name:s.Loc.getMessage("IMAGE_EDITOR_TRANSFORM_TITLE")},dimensions:{lock:s.Loc.getMessage("IMAGE_EDITOR_LOCK_RESOLUTION")},button:{reset:s.Loc.getMessage("IMAGE_EDITOR_TRANSFORM_RESET_TO_DEFAULT")},asset:{imgly_transforms_common:{name:s.Loc.getMessage("IMAGE_EDITOR_COMMON_CROPS"),asset:{imgly_transform_common_custom:s.Loc.getMessage("IMAGE_EDITOR_RATIOS_CUSTOM"),imgly_transform_common_square:s.Loc.getMessage("IMAGE_EDITOR_RATIOS_SQUARE"),"imgly_transform_common_4-3":"4:3","imgly_transform_common_16-9":"16:9"}},imgly_transforms_facebook:{name:s.Loc.getMessage("IMAGE_EDITOR_TRANSFORM_FACEBOOK"),asset:{imgly_transform_facebook_ad:s.Loc.getMessage("IMAGE_EDITOR_TRANSFORM_FACEBOOK_AD"),imgly_transform_facebook_post:s.Loc.getMessage("IMAGE_EDITOR_TRANSFORM_FACEBOOK_POST"),imgly_transform_facebook_cover:s.Loc.getMessage("IMAGE_EDITOR_TRANSFORM_FACEBOOK_COVER"),imgly_transform_facebook_profile:s.Loc.getMessage("IMAGE_EDITOR_TRANSFORM_FACEBOOK_PROFILE")}}},placeholder:{width:s.Loc.getMessage("IMAGE_EDITOR_SIZE_WIDTH"),height:s.Loc.getMessage("IMAGE_EDITOR_SIZE_WIDTH")}},filter:{asset:{identity:s.Loc.getMessage("IMAGE_EDITOR_FILTERS_NONE"),imgly_lut_celsius:"Inferno",imgly_lut_chest:"Chestnut",imgly_lut_fixie:"Fixie",imgly_lut_fridge:"Fridge",imgly_lut_front:"Sunny 70s",imgly_lut_k2:"Flat Black",imgly_lut_mellow:"Mellow",imgly_lut_sin:"Hard Stuff",imgly_lut_texas:"Oldtimer",imgly_lut_ad1920:"1920 A.D.",imgly_lut_ancient:"Ancient",imgly_lut_bleached:"Kalmen",imgly_lut_bleachedblue:"Joran",imgly_lut_blues:"Polaroid",imgly_lut_blueshadows:"Zephyr",imgly_lut_breeze:"Levante",imgly_lut_bw:"Greyed",imgly_lut_classic:"Classic",imgly_lut_colorful:"Colorful",imgly_lut_cool:"Snappy",imgly_lut_cottoncandy:"Cotton Candy",imgly_lut_creamy:"Creamy",imgly_lut_eighties:"Low Fire",imgly_lut_elder:"Colla",imgly_lut_evening:"Sunrise",imgly_lut_fall:"Moss",imgly_lut_food:"Food",imgly_lut_glam:"Glam",imgly_lut_gobblin:"Gobblin",imgly_lut_highcarb:"High Carb",imgly_lut_highcontrast:"High Contrast",imgly_lut_k1:"K1",imgly_lut_k6:"K6",imgly_lut_kdynamic:"Pebble",imgly_lut_keen:"Keen",imgly_lut_lenin:"Lemon",imgly_lut_litho:"Litho",imgly_lut_lomo:"Lomo",imgly_lut_lomo100:"Lomo 100",imgly_lut_lucid:"Lucid",imgly_lut_neat:"Neat",imgly_lut_nogreen:"Pumpkin",imgly_lut_orchid:"Solanus",imgly_lut_pale:"Pale",imgly_lut_pitched:"Pitched",imgly_lut_plate:"Weathered",imgly_lut_pola669:"Green Gap",imgly_lut_polasx:"Pola SX",imgly_lut_pro400:"Pro 400",imgly_lut_quozi:"Quozi",imgly_lut_sepiahigh:"Sepia",imgly_lut_settled:"Settled",imgly_lut_seventies:"Seventies",imgly_lut_soft:"Soft",imgly_lut_steel:"Steel",imgly_lut_summer:"Summer",imgly_lut_sunset:"Golden",imgly_lut_tender:"Tender",imgly_lut_twilight:"Twilight",imgly_lut_winter:"Softy",imgly_lut_x400:"Dusty",imgly_duotone_desert:"Desert",imgly_duotone_peach:"Peach",imgly_duotone_clash:"Clash",imgly_duotone_plum:"Plum",imgly_duotone_breezy:"Breezy",imgly_duotone_deepblue:"Deep Blue",imgly_duotone_frog:"Frog",imgly_duotone_sunset:"Sunset"},title:{name:s.Loc.getMessage("IMAGE_EDITOR_FILTERS_TITLE")}},adjustments:{button:{reset:s.Loc.getMessage("IMAGE_EDITOR_ADJUSTMENT_RESET")},title:{name:s.Loc.getMessage("IMAGE_EDITOR_ADJUSTMENT"),basics:s.Loc.getMessage("IMAGE_EDITOR_ADJUSTMENT_BASIC"),refinements:s.Loc.getMessage("IMAGE_EDITOR_ADJUSTMENT_REFINEMENTS_1")},text:{brightness:s.Loc.getMessage("IMAGE_EDITOR_ADJUSTMENT_BRIGHTNESS"),saturation:s.Loc.getMessage("IMAGE_EDITOR_ADJUSTMENT_SATURATION"),contrast:s.Loc.getMessage("IMAGE_EDITOR_ADJUSTMENT_CONTRAST"),gamma:s.Loc.getMessage("IMAGE_EDITOR_ADJUSTMENT_GAMMA"),clarity:s.Loc.getMessage("IMAGE_EDITOR_ADJUSTMENT_CLARITY"),exposure:s.Loc.getMessage("IMAGE_EDITOR_ADJUSTMENT_EXPOSURE"),shadows:s.Loc.getMessage("IMAGE_EDITOR_ADJUSTMENT_SHADOWS"),highlights:s.Loc.getMessage("IMAGE_EDITOR_ADJUSTMENT_HIGHLIGHTS"),whites:s.Loc.getMessage("IMAGE_EDITOR_ADJUSTMENT_WHITES"),blacks:s.Loc.getMessage("IMAGE_EDITOR_ADJUSTMENT_BLACKS"),temperature:s.Loc.getMessage("IMAGE_EDITOR_ADJUSTMENT_TEMPERATURE"),sharpness:s.Loc.getMessage("IMAGE_EDITOR_ADJUSTMENT_SHARPNESS")}},focus:{title:{name:s.Loc.getMessage("IMAGE_EDITOR_FOCUS_TITLE")},button:{none:s.Loc.getMessage("IMAGE_EDITOR_FOCUS_NONE"),radial:s.Loc.getMessage("IMAGE_EDITOR_FOCUS_RADIAL"),mirrored:s.Loc.getMessage("IMAGE_EDITOR_FOCUS_MIRRORED"),linear:s.Loc.getMessage("IMAGE_EDITOR_FOCUS_LINEAR"),gaussian:s.Loc.getMessage("IMAGE_EDITOR_FOCUS_GAUSSIAN")}},text:{title:{name:s.Loc.getMessage("IMAGE_EDITOR_TEXT_TITLE"),font:s.Loc.getMessage("IMAGE_EDITOR_TEXT_FONT"),size:s.Loc.getMessage("IMAGE_EDITOR_TEXT_SIZE"),spacing:s.Loc.getMessage("IMAGE_EDITOR_TEXT_PARAMS"),line:s.Loc.getMessage("IMAGE_EDITOR_TEXT_LINE_HEIGHT"),background:"Background"},placeholder:{defaultText:s.Loc.getMessage("IMAGE_EDITOR_TEXT_DEFAULT_TEXT")},button:{new:s.Loc.getMessage("IMAGE_EDITOR_TEXT_NEW_TEXT")}},textdesign:{title:{name:s.Loc.getMessage("IMAGE_EDITOR_TEXT_DESIGN"),input:"Text"},button:{invert:"Text as mask",new:"New Text Design"}},sticker:{title:{name:s.Loc.getMessage("IMAGE_EDITOR_STICKERS_TITLE"),opacity:s.Loc.getMessage("IMAGE_EDITOR_STICKERS_OPACITY")},text:{stickerLoadingError:"Failed to load sticker ${path}."},button:{replace:s.Loc.getMessage("IMAGE_EDITOR_STICKERS_REPLACE"),new:s.Loc.getMessage("IMAGE_EDITOR_STICKERS_NEW"),upload:s.Loc.getMessage("IMAGE_EDITOR_STICKERS_NEW"),fill:s.Loc.getMessage("IMAGE_EDITOR_STICKERS_FILL")},asset:{imgly_sticker_custom:"Eigene Sticker",imgly_sticker_emoticons:"Emoticons",imgly_sticker_emoticons_alien:"Alien",imgly_sticker_emoticons_angel:"Angel",imgly_sticker_emoticons_angry:"Angry",imgly_sticker_emoticons_anxious:"Anxious",imgly_sticker_emoticons_asleep:"Asleep",imgly_sticker_emoticons_attention:"Attention",imgly_sticker_emoticons_baby_chicken:"Baby Chicken",imgly_sticker_emoticons_batman:"Batman",imgly_sticker_emoticons_beer:"Beer",imgly_sticker_emoticons_black:"Black",imgly_sticker_emoticons_blue:"Blue",imgly_sticker_emoticons_blush:"Blush",imgly_sticker_emoticons_boxer:"Boxer",imgly_sticker_emoticons_business:"Business",imgly_sticker_emoticons_chicken:"Chicken",imgly_sticker_emoticons_cool:"Cool",imgly_sticker_emoticons_cry:"Cry",imgly_sticker_emoticons_deceased:"Deceased",imgly_sticker_emoticons_devil:"Devil",imgly_sticker_emoticons_duckface:"Duckface",imgly_sticker_emoticons_furious:"Furious",imgly_sticker_emoticons_grin:"Grin",imgly_sticker_emoticons_guitar:"Guitar",imgly_sticker_emoticons_harry_potter:"Harry Potter",imgly_sticker_emoticons_hippie:"Hippie",imgly_sticker_emoticons_hitman:"Hitman",imgly_sticker_emoticons_humourous:"Humourous",imgly_sticker_emoticons_idea:"Idea",imgly_sticker_emoticons_impatient:"Impatient",imgly_sticker_emoticons_kiss:"Kiss",imgly_sticker_emoticons_kisses:"Kisses",imgly_sticker_emoticons_laugh:"Laugh",imgly_sticker_emoticons_loud_cry:"Loud Cry",imgly_sticker_emoticons_loving:"Loving",imgly_sticker_emoticons_masked:"Masked",imgly_sticker_emoticons_music:"Music",imgly_sticker_emoticons_nerd:"Nerd",imgly_sticker_emoticons_ninja:"Ninja",imgly_sticker_emoticons_not_speaking_to_you:"Not speaking to you",imgly_sticker_emoticons_pig:"Pig",imgly_sticker_emoticons_pumpkin:"Pumpkin",imgly_sticker_emoticons_question:"Question",imgly_sticker_emoticons_rabbit:"Rabbit",imgly_sticker_emoticons_sad:"Sad",imgly_sticker_emoticons_sick:"Sick",imgly_sticker_emoticons_skateboard:"Skateboard",imgly_sticker_emoticons_skull:"Skull",imgly_sticker_emoticons_sleepy:"Sleepy",imgly_sticker_emoticons_smile:"Smile",imgly_sticker_emoticons_smoking:"Smoking",imgly_sticker_emoticons_sobbing:"Sobbing",imgly_sticker_emoticons_star:"Star",imgly_sticker_emoticons_steaming_furious:"Steaming Furious",imgly_sticker_emoticons_sunbathing:"Sunbathing",imgly_sticker_emoticons_tired:"Tired",imgly_sticker_emoticons_tongue_out_wink:"Tongue out wink",imgly_sticker_emoticons_wave:"Wave",imgly_sticker_emoticons_wide_grin:"Wide Grin",imgly_sticker_emoticons_wink:"Wink",imgly_sticker_emoticons_wrestler:"Wrestler",imgly_sticker_shapes:"Shapes",imgly_sticker_shapes_arrow_02:"Arrow 1",imgly_sticker_shapes_arrow_03:"Arrow 2",imgly_sticker_shapes_badge_01:"Badge 1",imgly_sticker_shapes_badge_11:"Badge 5",imgly_sticker_shapes_badge_12:"Badge 6",imgly_sticker_shapes_badge_13:"Badge 7",imgly_sticker_shapes_badge_15:"Badge 8",imgly_sticker_shapes_badge_18:"Badge 9",imgly_sticker_shapes_badge_19:"Badge 10",imgly_sticker_shapes_badge_20:"Badge 11",imgly_sticker_shapes_badge_28:"Badge 12",imgly_sticker_shapes_badge_32:"Badge 13",imgly_sticker_shapes_badge_35:"Badge 14",imgly_sticker_shapes_badge_36:"Badge 15",imgly_sticker_shapes_badge_04:"Badge 2",imgly_sticker_shapes_badge_06:"Badge 3",imgly_sticker_shapes_badge_08:"Badge 4",imgly_sticker_shapes_spray_01:"Spray 1",imgly_sticker_shapes_spray_03:"Spray 2",imgly_sticker_shapes_spray_04:"Spray 3"}},brush:{title:{name:s.Loc.getMessage("IMAGE_EDITOR_BRUSH_TITLE"),width:s.Loc.getMessage("IMAGE_EDITOR_BRUSH_WIDTH"),hardness:s.Loc.getMessage("IMAGE_EDITOR_BRUSH_HARDNESS"),settings:s.Loc.getMessage("IMAGE_EDITOR_BRUSH_SETTINGS")}},frame:{title:{name:s.Loc.getMessage("IMAGE_EDITOR_FRAME_TITLE"),opacity:s.Loc.getMessage("IMAGE_EDITOR_FRAME_OPACITY"),width:s.Loc.getMessage("IMAGE_EDITOR_FRAME_WIDTH")},button:{fill:s.Loc.getMessage("IMAGE_EDITOR_FRAME_FILL"),replace:s.Loc.getMessage("IMAGE_EDITOR_FRAME_REPLACE"),none:s.Loc.getMessage("IMAGE_EDITOR_FRAME_NONE")},asset:{imgly_frame_dia:"Dia",imgly_frame_art_decor:"Art Decor",imgly_frame_black_passepartout:"Black Passepartout",imgly_frame_lowpoly_shadow:"Low Poly",imgly_frame_wood_passepartout:"Wood Passepartout"}},artfilter:{title:{name:"Art Filters"},asset:{none:"None",imgly_art_filter_june_tree:"Natasha Wescoat",imgly_art_filter_hive:"Hive",imgly_art_filter_udnie:"Udnie",imgly_art_filter_vince_low:"Vince Low",imgly_art_filter_mosaic:"Mosaic",imgly_art_filter_wave:"Wave",imgly_art_filter_watercolor:"Malikova Darya"}},overlay:{title:{name:s.Loc.getMessage("IMAGE_EDITOR_OVERLAY_TITLE"),blending:"Blending",none:"None",normal:"Normal",overlay:"Overlay",hardLight:"Hard Light",softLight:"Soft Light",multiply:"Multiply",darken:"Darken",lighten:"Lighten",screen:"Screen",colorBurn:"Color Burn"},button:{none:s.Loc.getMessage("IMAGE_EDITOR_OVERLAY_NONE")},asset:{imgly_overlay_bokeh:"Bokeh",imgly_overlay_chop:"Chop",imgly_overlay_clouds:"Clouds",imgly_overlay_golden:"Golden",imgly_overlay_grain:"Grain",imgly_overlay_hearts:"Hearts",imgly_overlay_lightleak1:"Light Leak 1",imgly_overlay_lightleak2:"Light Leak 2",imgly_overlay_metal:"Metal",imgly_overlay_mosaic:"Mosaic",imgly_overlay_painting:"Painting",imgly_overlay_paper:"Paper",imgly_overlay_rain:"Rain",imgly_overlay_vintage:"Vintage",imgly_overlay_wall1:"Wall",imgly_overlay_wall2:"Wall 2",imgly_overlay_wood:"Wood"}}}};function n(e){var t=e.src,i=e.proxy;return new Promise(function(e,o){var _=function(){var e=new s.Uri(t);var o=e.getHost();if(o===""||o===window.location.host||o===window.location.hostname){return t}if(s.Type.isString(i)){return s.Uri.addParam(i,{sessid:BX.bitrix_sessid(),url:t})}return t}();var a=function(){if(s.Type.isString(_)){var e=new Image;e.src=_;return e}return a}();if(s.Type.isDomNode(a)&&a instanceof HTMLImageElement){if(a.complete){e(a);return}a.onload=function(){return e(a)};a.onerror=o}})}function r(e){if(s.Type.isString(e)){return e.split("/").pop()}return""}function l(e,t){if(s.Type.isString(e)&&s.Type.isString(t)){var i=e.lastIndexOf(".");if(i>0){return"".concat(e.substr(0,i),".").concat(t)}}return e}function g(e){if(s.Type.isPlainObject(e)){var t=e.categories;if(s.Type.isArray(t)){t.forEach(function(e){var t=e.ratios;if(s.Type.isArray(t)){t.forEach(function(e){if(BX.type.isPlainObject(e)&&BX.type.isPlainObject(e.dimensions)){e.dimensions=new window.PhotoEditorSDK.Math.Vector2(e.dimensions.width,e.dimensions.height)}})}})}}return e}function c(){var e=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="main-image-editor-error">\n\t\t\t\t\t<div class="main-image-editor-error-text">\n\t\t\t\t\t\t','\n\t\t\t\t\t</div>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<button class="ui-btn" onclick="','">\n\t\t\t\t\t\t\t',"\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t"]);c=function t(){return e};return e}var m=Symbol("onPopupClose");var E=Symbol("onWindowResize");var u=Symbol("onEditorExport");var y=Symbol("onEditorClose");var I=Symbol("currentImage");var d=Symbol("resolver");var T=function(){babelHelpers.createClass(e,null,[{key:"getInstance",value:function t(){if(!e.instance){e.instance=new e}return e.instance}}]);function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,e);this.options=t;this.SDKInstance=null;this[m]=this[m].bind(this);this[E]=this[E].bind(this);this[u]=this[u].bind(this);this[y]=this[y].bind(this);this.cache=new s.Cache.MemoryCache;this.popup=this.getPopup();this.loader=this.getLoader();s.Event.bind(window,"resize",this[E])}babelHelpers.createClass(e,[{key:"getPopup",value:function e(){var i=this;return this.cache.remember("popup",function(){return new t.PopupWindow({id:"main-image-editor-".concat(s.Text.getRandom()),width:window.innerWidth-10,height:window.innerHeight-10,zIndex:900,overlay:.9,noAllPaddings:true,className:"main-image-editor",animationOptions:{show:{className:"main-image-editor-show",eventType:"animation"},close:{className:"main-image-editor-close",eventType:"animation"}},events:{onPopupClose:i[m]}})})}},{key:"getLoader",value:function e(){var t=this;return this.cache.remember("loader",function(){return new i.Loader({target:t.getPopup().getPopupContainer()})})}},{key:"show",value:function e(){this.getPopup().show();s.Dom.style(document.documentElement,"overflow","hidden")}},{key:"close",value:function e(){this.getPopup().close();s.Dom.style(document.documentElement,"overflow",null)}},{key:y,value:function e(){this.close();s.Dom.clean(this.popup.contentContainer)}},{key:u,value:function e(t,i){var o=i.getOptions();var _=BX.Main.ImageEditor.renderType.BASE64;if(s.Type.isPlainObject(o)&&s.Type.isPlainObject(o.editor)&&s.Type.isPlainObject(o.editor.export)&&o.editor.export.type===_){var a=t.split(","),n=babelHelpers.slicedToArray(a,2),g=n[0],c=n[1];var m=g.match(/data:image\/(.*);base64/),E=babelHelpers.slicedToArray(m,2),u=E[1];var y=l(r(this[I].src),u);this[d]([y,c]);this.close();return}this[d](t);this.close()}},{key:m,value:function e(){if(this.SDKInstance){this.SDKInstance.off("export",this[u]);this.SDKInstance.off("close",this[y]);this.SDKInstance.dispose()}BX.onCustomEvent(this,"BX.Main.ImageEditor:close",[this])}},{key:E,value:function e(){var t=window,i=t.innerWidth,s=t.innerHeight;this.getPopup().setWidth(i-10);this.getPopup().setHeight(s-10)}},{key:"createErrorMessage",value:function e(){var t=this;return this.cache.remember("errorMessage",function(){var e=function e(){return t.getPopup().close()};return s.Tag.render(c(),s.Loc.getMessage("IMAGE_EDITOR_POPUP_ERROR_MESSAGE_TEXT"),e,s.Loc.getMessage("IMAGE_EDITOR_CLOSE_POPUP"))})}},{key:"isValidEditOptions",value:function e(t){return s.Type.isDomNode(t)&&t instanceof HTMLImageElement||s.Type.isString(t)&&t.length>0||s.Type.isPlainObject(t)&&this.isValidEditOptions(t.image)}},{key:"apply",value:function e(){this.SDKInstance.export()}},{key:"edit",value:function e(t){var i=this;if(!this.isValidEditOptions(t)){throw new Error("BX.Main.ImageEditor: invalid options. options must be a string, HTMLImageElement or plainObject with image field.")}var r=function(){var e=i.getPopup().contentContainer;if(s.Type.isPlainObject(t)){var _=t.controlsOptions;if(s.Type.isPlainObject(_)&&s.Type.isPlainObject(_.transform)){_.transform=g(_.transform)}return s.Runtime.merge(o,t,{container:e})}return babelHelpers.objectSpread({},o,{image:t,container:e})}();this.show();this.getLoader().show();BX.onCustomEvent(this,"BX.Main.ImageEditor:show",[this]);return n({src:r.image,proxy:r.proxy}).then(function(e){i[I]=e;return s.Runtime.loadExtension(["main.imageeditor.external.react.production","main.imageeditor.external.photoeditorsdk"])}).then(function(){var e=window.PhotoEditorSDK.UI.DesktopUI;i.SDKInstance=new e({container:r.container,assets:r.assets,showHeader:false,responsive:true,preloader:false,versionCheck:false,logLevel:"error",language:"ru",editor:{preferredRenderer:r.preferredRenderer,maxMegaPixels:{desktop:r.megapixels},forceCrop:r.forceCrop,displayCloseButton:true,export:r.export,controlsOptions:r.controlsOptions,defaultControl:r.defaultControl,image:i[I]},extensions:{languages:{ru:a}},license:JSON.stringify(_)});i.SDKInstance.on("export",i[u]);i.SDKInstance.on("close",i[y]);i.getLoader().hide();return new Promise(function(e){i[d]=e})})}}]);return e}();babelHelpers.defineProperty(T,"ratio",{CUSTOM:"imgly_transform_common_custom",SQUARE:"imgly_transform_common_square","4/3":"imgly_transform_common_4-3","16/9":"imgly_transform_common_16-9",PROFILE:"imgly_transform_facebook_profile",FB_AD:"imgly_transform_facebook_ad",FB_POST:"imgly_transform_facebook_post",FB_COVER:"imgly_transform_facebook_cover"});babelHelpers.defineProperty(T,"renderType",{BASE64:"data-url",IMAGE:"image",BUFFER:"buffer",BLOB:"blob",MSBLOB:"ms-blob"});e.ImageEditor=T})(this.BX.Main=this.BX.Main||{},BX.Main,BX,BX);
//# sourceMappingURL=imageeditor.bundle.map.js